#ifndef _COORDINATE_H
#define _COORDINATE_H

#ifdef GALLIUMENGINE_DLL 
#define GALLIUMENGINE_API __declspec( dllexport )
#else
#define GALLIUMENGINE_API __declspec( dllimport )
#endif

namespace GalliumEngine
{

	struct GALLIUMENGINE_API Coordinate
	{
	public:
		Coordinate()
		{
			this->value[0] = 0;
			this->value[1] = 0;
		}

		Coordinate(int x, int y)
		{
			this->value[0] = x;
			this->value[1] = y;
		}

		inline int x()
		{
			return value[0];
		}

		inline int y()
		{
			return value[1];
		}

		inline void operator =(Coordinate v)
		{
			(*this)[0] = v[0];
			(*this)[1] = v[1];
		}

		inline bool operator ==(Coordinate v)
		{
			if ((*this)[0] == v[0] && (*this)[1] == v[1])
			{
				return true;
			}

			return false;
		}

		inline bool operator !=(Coordinate v)
		{
			if ((*this)[0] != v[0] || (*this)[1] != v[1])
			{
				return true;
			}

			return false;
		}

		inline Coordinate operator +(Coordinate v)
		{
			return Coordinate((*this)[0]+v[0],(*this)[1]+v[1]);
		}

		inline void operator +=(Coordinate v)
		{
			(*this)[0] += v[0];
			(*this)[1] += v[1];
		}

		inline Coordinate operator -(Coordinate v)
		{
			return Coordinate((*this)[0]-v[0],(*this)[1]-v[1]);
		}

		inline void operator -=(Coordinate v)
		{
			(*this)[0] -= v[0];
			(*this)[1] -= v[1];
		}

		inline Coordinate operator -()
		{
			return Coordinate(-(*this)[0],-(*this)[1]);
		}

		inline int operator *(Coordinate v)
		{
			return (*this)[0]*v[0]+(*this)[1]*v[1];
		}

		inline Coordinate operator *(int d)
		{
			return Coordinate((*this)[0]*d,(*this)[1]*d);
		}

		inline void operator *=(int d)
		{
			(*this)[0] *= d;
			(*this)[1] *= d;
		}

		inline Coordinate operator /(int d)
		{	 
			return Coordinate((*this)[0]/d,(*this)[1]/d);
		}

		inline void operator /=(int d)
		{	
			(*this)[0] /= d;
			(*this)[1] /= d;
		}

		inline int& operator[] (unsigned int i)
		{
			return value[i];
		}
	
		inline int operator[] (unsigned int i) const
		{
			return value[i];
		}

	private:
		int value[2];
	};

}

#endif